package com.sql.parse.ognl;

import org.apache.ibatis.scripting.xmltags.OgnlCache;

public class VarDeclSqlNode implements DataNode {

	  private final String name;
	  private final String expression;

	  public VarDeclSqlNode(String var, String exp) {
	    name = var;
	    expression = exp;
	  }

	@Override
	  public boolean apply(MyDynamicContext context) {
	    final Object value = OgnlCache.getValue(expression, context.getBindings());
	    context.bind(name, value);
	    return true;
	  }

	}